<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="KCrawler官网" content="https://kc.kagura.me/">
    <meta name="鹞之神乐" content="https://www.kagura.me/">
    <meta name="GitHub" content="https://github.com/KingFalse/KCrawler">
    <title>KCrawler-开源云爬虫</title>
    <link href="/css/index.css" rel="stylesheet" type=text/css>
    <script src="/js/jquery-3.3.1.min.js"></script>
    <link href="/css/loading/style.css" rel="stylesheet" type=text/css>
</head>
<body>
<input id="traceId" th:value="${traceId}" type="hidden">
<div class="wrapper" id="startCrawl">
    <div class="content">
        <div class="title">KCrawler正在爬取数据...</div>
        <div class="loading-box">
            <svg viewBox="0 0 800 400" xmlns="http://www.w3.org/2000/svg">
                <defs>
                    <line class="mark" fill="none" stroke="#ee695a" stroke-linecap="none" stroke-miterlimit="10"
                          stroke-width="12" x1="0" x2="0"
                          y1="0" y2="0"/>
                </defs>
                <g class="container1"/>
                <g class="container2"/>

            </svg>
            <script src="/js/loading/TweenMax.min.js"></script>
            <script src="/js/loading/index.js"></script>
        </div>
    </div>
</div>
</body>
<script lang="javascript">
    $(function () {
        var traceId = $("#traceId").val();
        //循环执行，每隔1秒钟执行一次 1000
        var time = window.setInterval(refreshCount, 1000);

        function refreshCount() {
            console.log("ready");
            $.get("/status", {"traceId": traceId, "r": new Date().getTime()}, function (data) {
                if (data.status) {
                    console.log("爬取完成");
                    //去掉定时器的方法
                    window.clearInterval(time);
                    window.location.href = "/success?traceId=" + traceId;
                }
            });
        }
    });
</script>
</html>